<script>
  import { CITY_GET_LOCATION } from './store/mutation-types';
  import { mapActions } from 'vuex';
  import { needRequestToken } from './utils/auth';
  import { getCategoryListApi } from './api';
  import request from './utils/wxRequest';

  export default {
    onLaunch() {
      // 小程序启动程序
      console.log('Lanuch APPPPPPPP');
      request.beforeAction()
        .then(token => {
          console.log('启动页面的前置操作');
        });
      // 判断请求token是否过期
      needRequestToken();
    },
    created() {
      this.getLocation();
    },
    methods: {
      ...mapActions('city', {
        'getLocation': CITY_GET_LOCATION
      }),
      getCategoryApi() {
        getCategoryListApi().catch(e => {
          console.log('请求报错');
        });
      }
    }
  };
</script>

<style>
  .container {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 200 rpx 0;
    box-sizing: border-box;
  }

  /* this rule will be remove */
  * {
    transition: width 2s;
    -moz-transition: width 2s;
    -webkit-transition: width 2s;
    -o-transition: width 2s;
  }

  @import "../node_modules/mpvue-zanui/src/assets/style/zanui.wxss";
</style>
